<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@include file="included/commons.jsp"%>
<title>
文档浏览器
</title>

</head>
<body onload="soaOpen();window.focus();" onunload="soaClose();">
<script language="javascript">
	var bDocOpen = false;
	var action = "${param.action}";
	var tid = "${param.tid}";
	var model;
	<c:if test="${param.model == null}">
	   model=0;
	</c:if>
	<c:if test="${param.model != null}">
	   model=${param.model};
	</c:if>	
	//alert(model);
	function soaOpen() 
	{ 
	    // alert(action);
		try {
			formData.SOAOfficeCtrl.SaveDocURL = "usedoc?action=save&wid=${param.wid}";    
			if(action == "new"){
			    formData.SOAOfficeCtrl.WebOpen("template?action=view&tid="+tid,0,"${loginuser.localName}","Excel.Sheet");
			}else if(action == "sum"){
			    formData.SOAOfficeCtrl.WebOpen("tempdoc/${filename}",0,"${loginuser.localName}","Excel.Sheet");  
			}else if(action=="view"){			    
			    formData.SOAOfficeCtrl.WebOpen("usedoc?action=open&wid=${param.wid}",model,"${loginuser.localName}","Excel.Sheet");
			}else if(action=="open"){
			    formData.SOAOfficeCtrl.WebOpen("usedoc?action=open&wid=${param.wid}",model,"${loginuser.localName}","Excel.Sheet");
			}			
		}
		catch (e)
		{
		   
           alert("打开文档失败 \n消息: "+e.message);
		}
	} 
	function soaClose()
	{
		try {
			if (bDocOpen)
				formData.SOAOfficeCtrl.Close();
			return true; 
		} 
		catch (e) 
		{ 
			alert("关闭文档失败!\n错误信息："+e.message); 
			return false; 
		} 
	}
</script>
<SCRIPT language="JavaScript" event="OnDocumentOpened(str, obj)"
	for="SOAOfficeCtrl">
			bDocOpen = true;
		</SCRIPT>
<SCRIPT language="JavaScript" event="OnDocumentClosed()"
	for="SOAOfficeCtrl">
			bDocOpen = false;
		</SCRIPT>
<form name="formData" method="post" id="formData">
<%@include file="soaobject.jsp"%>

</form>
</body>
</html>
